import java.io.IOException;
import java.io.OutputStream;

/**
 * A listing, containing annotated copies of each line from the input source
 *
 * The listing adds to each line its location and its binary translation, for
 * those lines which define instructions.  It is the most complete output
 * produced by the parser.
 *
 * @author Andrew Krieger
 * @version 0.1
 * @since 1 Apr 2012
 */

public interface IListing {
    /**
     * Add a parsed line to the listing.
     *
     * A line may be an instruction, a directive, or a pure comment.  The first
     * two are handled the same from the outside; just pass in the right
     * mnemonic and the IListing object will decide which it is.  A pure
     * comment should have its mnemonic set to NONE.
     *
     * @param line The line number being parsed
     * @param label The label on the line
     * @param comment The comment on the line
     * @param mnemonic The mnemonic
     * @param ops A list of operands, possibly empty
     */
    public void addLine(int line, String label, String comment,
			Mnemonic mnemonic, Iterable<Operand> ops);

    /**
     * Get the current location counter
     *
     * @return The current location counter
     */
    public int getCurrentLC();

    /**
     * Print a listing file to the supplied Stream
     *
     * Formats and outputs a listing file, according to the specifed format.
     *
     * @param os The stream to write to
     * @throws IOException If an I/O error occurs
     */
    public void print(OutputStream os) throws IOException;
}
